home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 June: Reference Library / Dev.CD Jun 96 RL / Dev.CD Jun 96 RL.toast / Technical Documentation / develop / develop Issue 24 / develop Issue 24 code / Scriptable Database 1.0a15 / Foundation / EntireContents.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-19  |  2.8 KB  |  101 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        EntireContents.h
  3.  
  4.     Contains:    Code for 'entire contents' property
  5.  
  6.     Written by:    Greg Anderson
  7.  
  8.     Copyright:    © 1993-1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.          <8>      6/6/95    ga        
  11. */
  12.  
  13. #ifndef __ENTIRECONTENTS__
  14. #define __ENTIRECONTENTS__
  15. #define EntireContents_h
  16.  
  17.  
  18. #define cEntireContents 'ects'
  19.  
  20. //
  21. // ProxyToken.h is needed because
  22. // TProxyToken is the base class of TEntireContents
  23. //
  24. #include "ProxyToken.h"
  25.  
  26. //
  27. // AbstractIterator is needed because TAbstractIterator
  28. // is the base class of TDeepIterator
  29. //
  30. #include "AbstractIterator.h"
  31.  
  32.  
  33. class TEntireContents : public TProxyToken
  34.     {
  35. public:
  36.     DeclareSmallClassData(TEntireContents, TProxyToken);
  37.  
  38.                                         TEntireContents();
  39.     virtual                                ~TEntireContents();
  40.     
  41.     void                                IEntireContents(TAbstractScriptableObject* rootIcon);
  42.  
  43.     virtual DescType                    ObjectClass(const TAETransaction& t, Boolean recordedClass = false);
  44.     virtual Boolean                        DerivedFromOSLClass(const TAETransaction& t, DescType objectClass);
  45.  
  46.     virtual Boolean                        PropertyAppliesToProxy(DescType propertyName);
  47.     virtual TAbstractObjectIterator*    ElementIterator(const TAETransaction&);
  48.     
  49. private:
  50.  
  51.     TAbstractScriptableObject*            fRootItem;
  52.     };
  53.  
  54. //========================================================================================
  55. // Class TDeepIterator
  56. //========================================================================================
  57. class TDeepIterator : public TAbstractObjectIterator
  58. {
  59. private:
  60.     TAbstractScriptableObject*            fRootItem;
  61.     TAbstractObjectIterator**            fIterStack;
  62.     long                                fItersOnStack;
  63.     long                                fStackSize;
  64.     Boolean                                fDirection;
  65.     
  66. public:
  67.     virtual ~TDeepIterator();
  68.     
  69.     TDeepIterator(TAbstractScriptableObject* rootItem) :
  70.         fRootItem(rootItem),
  71.         fIterStack(nil),
  72.         fItersOnStack(0),
  73.         fStackSize(0),
  74.         fDirection(kForwardIteration) {}
  75.     
  76.     void                                FocusOnNewRoot(TAbstractScriptableObject* newRoot) { fRootItem = newRoot; }
  77.  
  78.     //
  79.     // Interface to code to:
  80.     //
  81.     virtual void                        Reset(const TAETransaction& t, Boolean iterationDirection = kForwardIteration);
  82.     virtual Boolean                        More(const TAETransaction&) const;
  83.     virtual void                        Next(const TAETransaction&);
  84.     virtual TAbstractScriptableObject*    Current(const TAETransaction&);
  85.  
  86.     virtual void                        AccessBySearchSpec(const TAETransaction& t, TAbstractCollector* collector, DescType desiredClass, TAbstractSearchSpec* searchSpec);
  87.     virtual void                        SearchDeep(const TAETransaction& t, TAbstractCollector* collector, DescType desiredClass, TAbstractSearchSpec* searchSpec);
  88.     
  89. private:
  90.     TAbstractObjectIterator*            TopIterator() const;
  91.     TAbstractObjectIterator*            PopIterator();
  92.     void                                PushIterator(TAbstractObjectIterator* iter);
  93.     void                                ClearIteratorStack();
  94.  
  95.     void                                PushSubtree(const TAETransaction& t, TAbstractScriptableObject* fromWhere);
  96. };
  97.  
  98.  
  99.  
  100. #endif
  101.